package com.ecoolex.cms.system.core;

import com.ecoolex.framework.cg.mybatis.MyBatisCodeGenerator;
import com.ecoolex.framework.cg.mybatis.core.ClassPluginInterface;
import com.ecoolex.framework.cg.mybatis.pojo.KeyValue;
import com.ecoolex.framework.cg.mybatis.support.DaoClassGenerate;
import com.ecoolex.framework.cg.mybatis.support.ManagerClassGenerate;

public class CmsSystemMyBatisCodegen {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		// 配置项目路径
		MyBatisCodeGenerator generator = MyBatisCodeGenerator.create("src/main/java", "com.ecoolex.cms.system.core",
				KeyValue.create(ClassPluginInterface.TARGET_ENTITY, "com.ecoolex.cms.system.entity"),
				KeyValue.create(ClassPluginInterface.OVERRIDE, "false"));
		// 添加转移目录
		generator.addTransferPackage("com.ecoolex.cms.system.entity", "../cms-system-entity/");
		// 配置数据库
		generator.setJdbcConnection("com.mysql.jdbc.Driver",
				"jdbc:mysql://47.101.161.12:3306/ctrip_cms?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull",
				"root", "Kcxx1245!", KeyValue.create("nullCatalogMeansCurrent", "true"));
		// 配置插件
		// 扩展dao插件
		generator.addPlugin(DaoClassGenerate.class);
		// 业务逻辑插件
		generator.addPlugin(ManagerClassGenerate.class);

		// 配置表
		// 自动增长主键模版
		// generator.createDefaultTable("member", "Member", "id");
		// 非自增长主键，自设主键模版
		// generator.createDefaultTable("user_info", "UserInfo");
		// vr 场景
		generator.createDefaultTable("cms_vr_scene", "VRScene", "SceneId");
		generator.createDefaultTable("cms_vr_scene_hotspot", "VRSceneHotspot", "HotspotId");
		generator.createDefaultTable("cms_vr_scene_hotspot_param", "VRSceneHotspotParam", "ParamId");
		generator.createDefaultTable("cms_vr_navi_path", "VRNaviPath", "Id");
		
		generator.createDefaultTable("sunrisedutyfree_application", "SunrisedutyfreeApplication");

		generator.generate();
	}
}
